package com.zrrd.api;

import java.time.DayOfWeek;
import java.time.LocalDateTime;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo02
 * @description
 * @create 2024/3/31
 */
public class Demo02 {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        int year = now.getYear();//获取是哪一年
        System.out.println("今年是"+year+"年");
        //获取月份
        int month = now.getMonthValue();
        System.out.println("当前是"+month+"月");
        //获取当前是当月的第几天
        int day = now.getDayOfMonth();
        System.out.println("今天是"+day+"号");

        //当前是今年的第几天
        int dayOfYear = now.getDayOfYear();
        DayOfWeek dayOfWeek = now.getDayOfWeek();
        System.out.println("今天是今年的第"+dayOfYear+"天，今天是"+dayOfWeek);

        int hour = now.getHour();
        int minute = now.getMinute();
        System.out.println("现在是"+hour+"点"+minute+"分");


    }
}
